package com.imooc.diveinspringboot.bootstarp;

import com.imooc.diveinspringboot.repository.MyFirstLevelRepository;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;

@ComponentScan(basePackages = "com.imooc.diveinspringboot.repository")

public class RepositoryBootstarp {
    public static void main(String[] args) {
        ConfigurableApplicationContext context = new SpringApplicationBuilder(RepositoryBootstarp.class)
                .web(WebApplicationType.NONE)
                .run(args);


        MyFirstLevelRepository myFirstLevelRepository = context.getBean("myFirstLevelRepository",MyFirstLevelRepository.class);

        System.out.println("MyFirstLevelRepository Bean "+myFirstLevelRepository);


        context.close();
    }
}
